package com.example.apiservice.client;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.apiservice.client.fallback.TeacherClientFallbackFactory;
import com.example.common.domain.Result;
import com.example.common.domain.dto.SaveSection;
import com.example.common.domain.pojo.*;
import com.example.common.domain.vo.QuestionVo;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;


@FeignClient(value = "teacher-service", fallbackFactory = TeacherClientFallbackFactory.class,
        url = "http://192.168.233.57:8182")
public interface TeacherClient {

    //大纲
    @PostMapping("/teacher/saveOutline")
    Result<Void> saveOutline(@RequestBody CourseOutline outline);

    //小节
    @PostMapping("/teacher/saveSection")
    Result<Void> saveSection(@RequestBody SaveSection save);

    //作业
    @PostMapping("/teacher/saveHomework")
    Result<Void> saveHomework(@RequestBody Homework homework);

    //单个题目
    @PostMapping("/teacher/saveQuestion")
    Result<Void> saveQuestion(@RequestBody Question question);

    //批量保存题目
    @PostMapping("/teacher/saveQuestions")
    Result<Void> saveQuestions(@RequestBody List<Question> questions);

    //小节和PPT,讲义关联，修改小节表
    @PostMapping("/teacher/UpdateSections")
    Result<Void> UpdateSections(@RequestBody Section section);

    //PPT保存
    @PostMapping("/teacher/savePPT")
    Result<Void> savePPT(@RequestBody Ppt ppt);

    //讲义保存
    @PostMapping("/teacher/saveHandouts")
    Result<Void> saveHandouts(@RequestBody Handouts handouts);

    //保存实验
    @PostMapping("/saveExperiment")
    Result<Void> saveExperiment(@RequestBody Experiment experiment);

    //保存反思
    @PostMapping("/saveRethink")
    Result<Void> saveRethink(@RequestBody Rethink rethink);

    @GetMapping("/teachers/generateOutline/{courseId}")
    Result<CourseOutline> getCourseOutline(
            @ApiParam(value = "课程ID", required = true)
            @PathVariable String courseId);

    //获取课程信息
    @GetMapping("/teachers/getCourseById/{id}")
    Result<Course> getCourseById(@PathVariable String id);

    //获取题目信息
    @GetMapping("/teachers/getQuestionsByHomeworkId/{homeworkId}")
    Result<Page<QuestionVo>> getQuestionsByHomeworkId(@PathVariable String homeworkId,
                                                      @RequestParam(defaultValue = "1") Integer pageNum,
                                                      @RequestParam(defaultValue = "10") Integer pageSize);





}
